<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>
<style type="text/css">
.btn {
	text-align: center;
	height: 30px;
	line-height: 30px;
	border-radius: 5px;
	cursor: pointer;
	background-color: cornflowerblue;
	color: block;
	margin: 0 auto;
}
</style>
<body>
<div id="abc">
<div class="uc_title m_10 tabs_menu">
	<label class="current node"><span>增加空闲时间</span></label>
</div>
	<table style="border: 1px; margin: 0 auto; background: snow"
		width="80%" height="300px" >
		<tr align="center">
			<td align="right">选择星期数</td><td><select style="width: 65%" v-model="day">
					<option value="1">星期一</option>
					<option value="2">星期二</option>
					<option value="3">星期三</option>
					<option value="4">星期四</option>
					<option value="5">星期五</option>
					<option value="6">星期六</option>
					<option value="7">星期七</option>
			</select></td>
		</tr>
		<tr align="center">
			<td align="right">选择具体时间</td><td><select style="width: 65%" v-model="when">
					<option value="1">早上</option>
					<option value="2">中午</option>
					<option value="3">晚上</option>
					<option value="4">全天</option>
			</select></td>
		</tr>
		<tr>
			<td colspan="4" align="center"><input type="submit" @click="onSubmit()"  class="btn" value="提交">
		</tr>
	</table>
	</div>
	<script type="text/javascript">
	new Vue({
		el:"#abc",
	data(){
			return{
				day:1,
				when:1,
			}
	},
		methods:{
			onSubmit:function(){
				//alert(id);
				var params =new URLSearchParams();
				params.append("day",this.day);
				params.append("when",this.when);
				axios.post(
					"/coach/addFreetimeByCid",	
					params
				).then(res=>{
					if(res.data.code==500){
						location.href="/error/500.html";
					}
					if(res.data.code==200){
						alert("增加成功！");
					}else{
						alert(res.data.msg);
					}
				});
			}
		},
	});
	</script>
</body>
</html>